import type { IRawMsg } from "./IRawMsg";
import type { IRawMsgRefer } from "./IRawMsgRefer";
import type { MsgSubTypeEnum } from "./MsgSubTypeEnum";
import type { MsgTypeEnum } from "./MsgTypeEnum";

export type RawMsgContents = IRawMsgContent_Refer | IRawMsgContent_Image |
  IRawMsgContent_File | IRawMsgContent_Video | IRawMsgContent_Link;

/**
 * 引用
 * 
 * @description 值得注意的是，当发送的消息不为文字，PC端微信的消息无引用信息
 * @description 
 *    当IRawMsg['type'] == MsgTypeEnum.Share && IRawMsg['subType'] == MsgSubTypeEnum.Refer, 
 *    有IRawMsg['contents']为RawMsgContent_Refer
 * @see {IRawMsg['type']}
 * @see {MsgTypeEnum.Share}
 * @see {IRawMsg['subType']}
 * @see {MsgSubTypeEnum.Refer}
 * @see {IRawMsg['contents']}
 * @export
 * @interface IRawMsgContent_Refer
 */
export interface IRawMsgContent_Refer {
  refer?: IRawMsgRefer;
}

/**
 * 图片消息的数据
 * 
 * @description 
 *    当IRawMsg['type'] == MsgTypeEnum.Image, 
 *    有IRawMsg['contents']为RawMsgContent_Image
 * @see {IRawMsg['type']}
 * @see {MsgTypeEnum.Image}
 * @see {IRawMsg['contents']}
 * VMsgSubTypeEnum
 * @export
 * @interface IRawMsgContent_Image
 */
export interface IRawMsgContent_Image {
  /**
   * 大图文件的路径。(相对数据目录)
   * @description 文件为加密过的dat文件
   * @example
   *    当imgfile为 `msg/attach/XXXX/2025-08/Img/filename.dat`
   *    数据路径为 `C:/hello`
   *    次数文件的绝对路径` C:/hello/msg/attach/XXXX/2025-08/Img/filename.dat`
   * @type {string}
   * @memberof RawMsgContent_Image
   */
  path?: string;

  /**
   * 文件md5值。
   * 
   * @type {string}
   * @memberof RawMsgContent_Image
   */
  md5?: string;

  /**
   * 大图文件的路径。(相对数据目录)
   * @description 文件为加密过的dat文件
   * @example 路径规则与大图文件一致
   * @type {string}
   * @memberof RawMsgContent_Image
   */
  thumb?: string;


  /**
   * 图片上传完成后，设置此值然后提交消息
   */
  img_url?: string | undefined;
}

export interface IRawMsgContent_File {
  md5?: string;
  title?: string;
}
export interface IRawMsgContent_Link {
  url?: string;
  title?: string;
}

export interface IRawMsgContent_Video {
  md5?: string;
  thumb?: string;
  videofile?: string;
}